Currently, a fingerprint sensor is disposed at a designated position (for example, a side edge or a rear side) of an electronic device. When the electronic device is in a locked state and the electronic device matches a fingerprint collected by the fingerprint sensor with a preset fingerprint, the electronic device may exit the locked state. In daily life, a user easily touches the fingerprint sensor by mistake when holding the electronic device during running, walking, or the like. The electronic device obtains, by means of fingerprint recognition, a result of matching the fingerprint collected by the fingerprint sensor with the preset fingerprint, and executes a response corresponding to the matching result. However, the user does not expect the response to be executed in a practical operation process.